<?php

namespace App;

use App\AdminUser;
use Illuminate\Database\Eloquent\Model;

class AdminRole extends Model
{
    protected $table = 'jyt_admin_roles';
    protected $fillable = ['name', 'description'];

    public function users()
    {
        return $this->belongsToMany(AdminUser::class, 'jyt_admin_role_admin_user');
    }

    public function menus()
    {
        return $this->belongsToMany(AdminMenu::class, 'jyt_admin_menu_admin_role');
    }

    public function permissions()
    {
        return $this->belongsToMany(AdminPermission::class, 'jyt_admin_permission_admin_role');
    }
}
